package com.jkl.gatewayserver.Tool.RabbitMQ.Producer;

import com.jkl.gatewayserver.Config.RabbitMQConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Producer {
    private final RabbitTemplate rabbitTemplate;
    @Autowired
    public Producer(RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
    }

    public void sendInsert(String message) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_CON,"insert", message);
    }
    public void sendUpdate(String message){
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_CON,"update", message);
    }
    public void sendDelete(String message){
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_CON,"delete", message);
    }

    public void sendApplication(String message) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_CON,"send", message);
    }

    public void sendAgreeApplication(String message){
        rabbitTemplate.convertAndSend(RabbitMQConfig.EXCHANGE_CON,"agree", message);
    }
}